﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="Users.aspx.cs" Inherits="PmSadis.WebFormsUi.Administrator.Users" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.2, Version=11.2.10.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridLookup" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v11.2, Version=11.2.10.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
    <%@ Register Assembly="DevExpress.Web.ASPxEditors.v11.2, Version=11.2.10.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<%--<asp:Content ID="usersHead" ContentPlaceHolderID="head" runat="server">
</asp:Content>--%>
<asp:Content ID="usersContent" ContentPlaceHolderID="content" runat="server">
    <link href="../Content/admin.users.css" rel="stylesheet" type="text/css" />
    <asp:ScriptManager ID="usersScriptManager" runat="server" />
    <h2>
        Пользователи</h2>
    <!--users data source-->
    <asp:ObjectDataSource ID="dsUsers" runat="server" TypeName="PmSadis.WebFormsUi.Administrator.Users"
        SelectMethod="GetAll" DeleteMethod="DeleteUser" InsertMethod="InsertUser" UpdateMethod="UpdateUser" />
    <!--roles data source-->
    <asp:ObjectDataSource ID="dsRoles" runat="server" TypeName="PmSadis.WebFormsUi.Administrator.Users"
        SelectMethod="GetAllRoles" />
    <asp:UpdatePanel ID="usersUpdatePanel" runat="server">
        <ContentTemplate>
            <dx:ASPxGridView ID="gvUsers" ClientInstanceName="gvUsers" runat="server" DataSourceID="dsUsers"
                KeyFieldName="UserId" OnRowInserting="gvUsers_RowInserting" OnRowUpdating="gvUsers_RowUpdating" >
                <Columns>
                    <dx:GridViewDataColumn FieldName="UserId" Visible="false" />
                    <dx:GridViewDataColumn FieldName="DateCreate" Visible="false" />
                    <dx:GridViewCommandColumn>
                        <NewButton Visible="true" />
                        <EditButton Visible="true" />
                        <DeleteButton Visible="true" />
                    </dx:GridViewCommandColumn>
                    <dx:GridViewDataTextColumn FieldName="UserName" Caption="Имя пользователя (логин)" />
                    <dx:GridViewDataTextColumn FieldName="Password" Caption="Пароль" Visible="false"
                        VisibleIndex="2">
                        <EditFormSettings Visible="True" />
                        <PropertiesTextEdit Password="true" />
                    </dx:GridViewDataTextColumn>
                    <dx:GridViewDataTextColumn FieldName="DisplayName" Caption="Отображаемое имя" />
                    <dx:GridViewDataColumn Caption="Роли" FieldName="Roles" Visible="false" VisibleIndex="11">
                        <EditFormSettings Visible="True" />
                        <EditItemTemplate>
                            <dx:ASPxGridLookup ID="userRoles" runat="server" DataSourceID="dsRoles" SelectionMode="Multiple"
                                KeyFieldName="Role" Width="100%" OnDataBinding="userRoles_DataBinding">
                                <Columns>
                                    <dx:GridViewCommandColumn ShowSelectCheckbox="true" Caption="Выбрать" />
                                    <dx:GridViewDataTextColumn FieldName="RoleName" Caption="Роли" />
                                </Columns>
                            </dx:ASPxGridLookup>
                        </EditItemTemplate>
                    </dx:GridViewDataColumn>
                </Columns>
            </dx:ASPxGridView>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
